package com.cloudcode.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Swagger配置
 * @author wx xinoso
 */
@Configuration
public class SwaggerConfig {

    @Bean
    public GroupedOpenApi userApi() {
        String[] paths = {"/**"};
        String[] packagedToMatch = {"com.cloudcode.controller"};
        return GroupedOpenApi.builder().group("cc").pathsToMatch(paths).packagesToScan(packagedToMatch).build();
    }

    @Bean
    public OpenAPI customOpenAPI() {
        Contact contact = new Contact();
        contact.setName("yunst");

        return new OpenAPI().info(new Info().title("cc").description("cc").contact(contact).version("3.0").termsOfService("https://cc.net").license(new License().name("cc").url("https://cc.net")));
    }

}